package com.fangngng.pushall.controller;

import com.fangngng.pushall.entity.Topic;
import com.fangngng.pushall.service.TopicService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;

/**
 * 主题广场
 * @author fei.fang
 * @date 2020/10/29
 **/
@Controller
@Slf4j
public class PlazaController{

    @Autowired
    private TopicService topicService;

    @GetMapping(value = "/plaza")
    public String plaza(Model model){
        log.info("plaza plz!");

        List<Topic> hottest10Topic = topicService.getHottest10Topic();
        List<Topic> newtest10Topic = topicService.getNewtest10Topic();
        model.addAttribute("hot10",hottest10Topic);
        model.addAttribute("new10",newtest10Topic);

        return "plaza";
    }



}
